package com.lanchetech.common.enums;

import lombok.Getter;

@Getter
public enum IdentityTypeEnum {
    MEMBER((byte) 0, "会员"),
    PARTNER((byte) 1, "合伙人"),//小店
    SHAREHOLDER((byte) 2, "运营中心"),
    ;

    private Byte type;
    private String remark;

    IdentityTypeEnum(Byte type, String remark) {
        this.type = type;
        this.remark = remark;
    }

    public static Byte getTypeByLevel(Integer level) {
        if (level < UserLevelEnum.MEMBER_L1.getLevel()) {
            return (byte) -1;
        } else if (level < UserLevelEnum.PARTNER_L1.getLevel()) {
            return (byte) 0;
        } else if (level < UserLevelEnum.SHAREHOLDER_L1.getLevel()) {
            return (byte) 1;
        } else {
            return (byte) 2;
        }
    }
    public static IdentityTypeEnum getIdentityTypeByLevel(Integer level) {
        if (level < UserLevelEnum.MEMBER_L1.getLevel()) {
            return null;
        } else if (level < UserLevelEnum.PARTNER_L1.getLevel()) {
            return MEMBER;
        } else if (level < UserLevelEnum.SHAREHOLDER_L1.getLevel()) {
            return PARTNER;
        } else {
            return SHAREHOLDER;
        }
    }
}
